/* -----------------------------------------------------------------------------
 * PROJECT    : lwf_handlers
 * FILE       : LwfWaterMarkText.java
 *
 * HISTORY:
 * Date          Author                        Description
 * ----------------------------------------------------------------------------- 
 * Jan 4, 2011  mycodetalks			       Created
 */
package net.lwf.pdf.util;

import net.lwf.pdf.IPdfConstant;

import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Document;
import com.itextpdf.text.Element;
import com.itextpdf.text.Font;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.Font.FontFamily;
import com.itextpdf.text.pdf.ColumnText;
import com.itextpdf.text.pdf.PdfPageEventHelper;
import com.itextpdf.text.pdf.PdfWriter;

/**
 * Class description goes here
 */
public class LwfWaterMarkText extends PdfPageEventHelper {
	
    public void onEndPage(PdfWriter writer, Document document) {
    	
    	Font FONT = new Font(FontFamily.TIMES_ROMAN, 200, Font.ITALIC, new BaseColor(0xee, 0xee, 0xee));
    	
        ColumnText.showTextAligned(writer.getDirectContentUnder(),
        		                   Element.ALIGN_CENTER, new Phrase(IPdfConstant.LWF_WATERMARK_TEXT, FONT),
        		                   297.5f, 
        		                   421, 
        		                   writer.getPageNumber() % 2 == 1 ? 45 : -45);
    }

} // LwfWaterMarkText



